package com.ddone.finance.controller.api;


import com.baomidou.mybatisplus.extension.api.R;
import com.ddone.common.result.Response;
import com.ddone.finance.pojo.entity.Dict;
import com.ddone.finance.service.DictService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 数据字典 前端控制器
 * </p>
 *
 * @author ddone
 * @since 2024-04-10
 */
@RestController
@RequestMapping("/core/api/dict")
@Api(tags = {"字典管理"})
public class DictController {
    @Resource
    private DictService dictService;

    @ApiOperation("根据dictCode获取下级节点")
    @GetMapping("/{dictCode}")
    public Response<Object> findByDictCode(
            @ApiParam(value = "节点编码", required = true)
            @PathVariable String dictCode) {
        List<Dict> list = dictService.findByDictCode(dictCode);
        return Response.ok(list);
    }
}

